import { h, render } from 'vue';
import ModalsConfirm from './index.vue';

export const userDrawer = (data: any) => {
    let { props, slot } = data;
    // 因为要等待用户操作，所以必须返回 Promise
    return new Promise((resolve) => {
        // 创建一个新节点，用来容纳 modal
        const node = document.createElement('div');
        const vnode = h(ModalsConfirm, props, [h(slot.components, slot.props)]);
        document.body.appendChild(node);
        render(vnode, node);
    });
}